import loadable from '@loadable/component';
import React from 'react';
import LoadingComp from 'src/pages/fallback/LoadingComp';
import { loadRoutes } from '../pages/page-routes';

export default async (injectRoutes = []) => injectRoutes.concat(await loadRoutes())
  .map((item) => ({
    path: item.path,
    component: loadable(item.component, {
      fallback: <LoadingComp />,
    }),
  }));
